<label class="tgl">
    <input type="checkbox">
    <span class="slider"></span>
</label>
<style>
/* From Uiverse.io by Saiyed-Tanvir - Tags: switch, animated, lever */
.tgl {
  position: relative;
  display: inline-block;
  width: 5em;
  height: 1em;
}

.tgl input {
  display: none;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 30px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 3.4em;
  width: 1.4em;
  border-radius: 20px;
  left: 0.3em;
  bottom: -1.3em;
  background-color: #ffffff;
  box-shadow: 0px 0px 5px #0009;
  transition: 1s cubic-bezier(0.49, -1.3, 0.45, 2.44);
}

.tgl input:checked + .slider {
  background-color: #2196F3;
}

.tgl input:checked + .slider:before {
  transform: translateX(2.5em) rotateZ(-180deg);
}
</style>
